/**
 * Created by yumeng on 2017/11/17.
 */
define([
  './themes/lang/' + window.YUFP_SYS_CONFIG.language + '/pages/example/template/exampleFormInfo.js'
], function (require, exports) {
  // page加载完成后调用ready方法
  exports.ready = function (hashCode, data, cite) {
    yufp.lookup.reg('NATIONALITY,YESNO');
    // 创建virtual model
    var vm = yufp.custom.vue({
      el: '#exampleFormInfo',
      data: function () {
        var me = this;
        return {
          editFields: [{
            columnCount: 2,
            fields: [
              { field: 'title', label: this.$t('exampleFormInfo.xxbt'), placeholder: this.$t('exampleFormInfo.dgzf'), type: 'input'},
              { field: 'type', label: this.$t('exampleFormInfo.lx'), type: 'select', dataCode: 'NATIONALITY'},
              { field: 'status', label: this.$t('exampleFormInfo.zt'), type: 'select', dataCode: 'PUBLISH_STATUS' },
              { field: 'author', label: this.$t('exampleFormInfo.zz'), type: 'input', placeholder: this.$t('exampleFormInfo.bjrxm')},
              { field: 'telNumber', label: this.$t('exampleFormInfo.lxdh'), type: 'input', placeholder: this.$t('exampleFormInfo.bjrlxdh')},
              { field: 'time', label: this.$t('exampleFormInfo.fbsj'), type: 'datetime', placeholder: this.$t('exampleFormInfo.szzdfbsj')},
              { field: 'tags', label: this.$t('exampleFormInfo.ssbq'), type: 'checkbox', dataCode: 'NATIONALITY' },
              { field: 'isTop', label: this.$t('exampleFormInfo.sfzd'), type: 'radio', dataCode: 'YESNO' }
            ]
          }, {
            columnCount: 1,
            fields: [
              { field: 'remark', label: this.$t('exampleFormInfo.nr'), placeholder: this.$t('exampleFormInfo.gzfyn'), type: 'textarea', rows: 6 }
            ]
          }],
          buttons: [
            {label: this.$t('exampleFormInfo.qx'),
              type: 'primary',
              icon: 'yx-undo2',
              click: function () {
              // do something
              }}
          ]
        };
      },
      mounted: function () {
        // 模拟初始化表单数据绑定
        // 模拟表单数据
        yufp.extend(this.$refs.myform.formModel, {
          title: this.$t('exampleFormInfo.gyjqzxsjtzdtzgg'),
          type: 'CN',
          status: 'draft',
          author: this.$t('exampleFormInfo.zs'),
          telNumber: '13800138000',
          time: '2017-12-18T22:13:56.109Z',
          tags: [
            this.$t('exampleFormInfo.oyq'),
            this.$t('exampleFormInfo.zg')
          ],
          isTop: this.$t('exampleFormInfo.f'),
          remark: this.$t('exampleFormInfo.zxsjbszmdwnjtbmgxrchdkzdsjbsdwnmgryzxrcgzdsjbz') +
                  this.$t('exampleFormInfo.yrscsrzmcdsyzxcdsyrtcwhjjslgndsljldsjckywcxyzyywzdwd') +
                  this.$t('exampleFormInfo.bzrtdzchdybljmczjjgxssgjswzrtwztldsjjdd')
        });
      },
      methods: {

      }
    });
  };
  // 消息处理
  exports.onmessage = function (type, message) {

  };
  // page销毁时触发destroy方法
  exports.destroy = function (id, cite) {

  };
});
